// @(#)excep.hh
// Time-stamp: <2009-02-11 16:55:06 root>
// Copyright 2008 Julian Qian
// Author: root@localhost.localdomain
// Version: $Id: excep.hh,v 0.0 2008/11/21 03:59:09 root Exp $
// Keywords: 
//

#ifndef _EXCEP_H
#define _EXCEP_H 1

#include <exception>
#include <stdexcept>
#include <string>

// using namespace std;

class Excep: public std::exception {
public:
	Excep(const Excep& e) throw();
    
	~Excep() throw() { }

	Excep& operator=(const Excep& rhs) throw();
    
    // Excep(string& ex);
    virtual const char* what() const throw();

    void whatis(const char* w){
        what_ = w;
    }
    
protected:
	Excep(const char* w = "") throw() :
        what_(w){}

	Excep(const std::string& w) throw() :
        what_(w){}
    
    std::string what_;
};


class Exception: public Excep {
public:
    explicit Exception(const char* w = "") :
        Excep(w) {}
};

class SocketException: public Excep {
public:
    explicit SocketException(const char* w) throw();
};

class GetMsgFailed: public Excep {
public:
    explicit GetMsgFailed(const char* w = "") :
        Excep(w) {}
};

class PutMsgFailed: public Excep {
public:
    explicit PutMsgFailed(const char* w = "") :
        Excep(w) {}
};

class LoginFailed: public Excep {
public:
    explicit LoginFailed(const char* u, int r) throw();
};

class ConfigError: public Excep {
public:
    explicit ConfigError(const char* w = "") :
        Excep(w) {}    
};

class EsmsInitFailed: public Excep {
public:
    explicit EsmsInitFailed(const char* w = "") :
        Excep(std::string("[ESMS_INIT_FAILED]") + w) {}  
};

class EsmsDisabled: public Excep {
public:
    explicit EsmsDisabled(const char* w = "") :
        Excep(std::string("[ESMS_DISABED]") + w) {}  
};

class AlarmInitFailed: public Excep {
public:
    explicit AlarmInitFailed(const char* w = "") :
        Excep(std::string("Alarm init failed at:") + w) {}
};

class HeartEngineFailed: public Excep {
public:
    explicit HeartEngineFailed(const char* w = "") :
        Excep(std::string("Heart failed at:") + w) {}    
};

class GetDevListException: public Excep {
public:
    explicit GetDevListException(const char* w = "") :
        Excep(std::string("[DevList]") + w) {}
};

class MsgServoException: public Excep {
public:
    explicit MsgServoException(const char* w = "") :
        Excep(std::string("MsgServo") + w) {}
};

class MsgPushException: public Excep {
public:
    explicit MsgPushException(const char* w = "") :
        Excep(std::string("MsgPush") + w) {}
};

class GetProtoError: public Excep {
public:
    explicit GetProtoError(const char* w = "") :
        Excep(std::string("GetProtoError") + w) {}
};   



#endif /* _EXCEP_H */

